package com.xuxin.baby.presenter;

import com.xuxin.baby.bean.BaseBean;
import com.xuxin.baby.bean.DoctorsBean;
import com.xuxin.baby.contract.DoctorContract;
import com.xuxin.baby.model.DoctorModel;

/**
 * Created by xu_xin
 * Created on 2020/11/23 0023
 * 专家详情
 */
public class DoctorPresenter implements DoctorContract.Presenter {
    private final DoctorModel model;
    private final DoctorContract.View view;

    public DoctorPresenter(DoctorContract.View view) {
        this.view = view;
        model = new DoctorModel();
    }

    @Override
    public void getDoctor(String tenantId, String token, String id) {
        if (null != model) {
            model.getDoctor(this, tenantId, token, id);
        }
    }

    @Override
    public void onSuccess(DoctorsBean doctorsBean) {
        if (null != view) {
            view.onSuccess(doctorsBean);
        }
    }

    /**
     * 以下内容复用(用于请求完成后的操作)
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}
